function mediaItem(){
	var Self = this;
	this.Id;
	
	// server
	this.Duration = 0;
	this.Length = 0;
	var SampleRate = 48000;
	this.Url;
	this.Name; // required
	this.Type;
	this.Meta = {
			title: '', // required
			artist: '' // required
	};
	//

	this.Buffering = true;
	this.Data = new dataQueue();
	this.CurrentTime = 0;
	var AudioScriptNode;
	this.Gain;
	var Offset = 0;
	var BufferSize = 16384;//8192, 16384
	var Run = false;
	//var pos; in sec ... falls es sinn macht des zwischen zu speichern (könnte auch über 2 methoden laufen)
	

	//vieleich in ein meta object
	//und dann über getMeta(name | type | etc)

	
	this.init = function(){};
	
	var process = function(e){
		var leftOut = e.outputBuffer.getChannelData(0);
		var rightOut = e.outputBuffer.getChannelData(1);
		if(Run){
			if(Offset < Self.Length){
				//loop
				var leftIn = Self.Data.getChannelData(0);
				var rightIn = Self.Data.getChannelData(1);
				
				for(var i in leftOut){
					leftOut[i] = leftIn[Offset];
					rightOut[i] = rightIn[Offset];
					Offset++;
				}
				Self.CurrentTime = Offset/SampleRate;
			}else{
				return onComplete();
			}
		}else{
			for(var i in leftOut){
				leftOut[i] = 0;
				rightOut[i] = 0;
			}
			
		}
	};
	var onComplete = function(){
		return false;
	};
	var setTime = function(time){
		Self.CurrentTime = time;
		Offset = Math.ceil(time*SampleRate);
	};
	

	//######################################################//
	//     		ab hier unser playAble interface			//
	//######################################################//
	
	/**
	 * @param time in sec
	 */
	this.noteOn = function(){
		if(Run)return false;
		if(arguments[0] === undefined){
			
			//ab momentaner pos starten
			Run = true;
		}else{
			//ab pos = arguments[0] starten
			setTime(arguments[0]);
			Run = true;
		}
		
	};
	/**
	 * @param time in sec
	 */
	this.noteOff = function(){
		if(arguments[0] === undefined){
			Run = false;
		}else{
			Run = false;
			Offset = arguments[0];
			Self.CurrentTime = Offset/SampleRate;
		}
	};
	this.connect = function(context, destination){
		//createJavaScriptNode(bufferSize, numberOfInputChannels, numberOfOutputChannels)
		this.Gain = context.createGainNode();
		AudioScriptNode = context.createJavaScriptNode(BufferSize,2,2);
		AudioScriptNode.onaudioprocess = process;
		AudioScriptNode.connect(this.Gain);
		console.log(AudioScriptNode);
		this.Gain.connect(destination);
	};
	this.disconnect = function(){
		AudioScriptNode.disconnect();
		AudioScriptNode = null;
	};
	//functions 2 fill with data 
	this.addChunk = function(buffer){
		if(buffer.byteLength){
			//arrayBuffer
			var context = new webkitAudioContext();
			context.decodeAudioData(buffer, function(audio){
				Self.addChunk(audio);
			});
		}else if(buffer.duration){
			//audiobuffer
	
			
			SampleRate = buffer.sampleRate;
			this.Length += buffer.length;
			this.Data.addChunk(buffer);
		}
	};
	this.complete = function(){//eventuell finalized oder so nenen ... wird nur im RC 
		Self.Duration = this.Data.duration;
		this.Buffering = false;
	};
	this.init();
}

